package cn.edu.scau.sec.zhangsan.singleton;

import java.util.HashSet;
import java.util.Set;

public class VicePresident {
	private static Set<VicePresident> vicePresidents = new HashSet<VicePresident>();
	
	private static final int vicePresidentQuantity = 7;
	
	private String name;
//	只能在该类中创建VicePresident的实例，
	private VicePresident(String name) {
		this.setName(name);
	}

	

	//	创建多例的实例，创建的实例放到vicePresidents中
	public static Set<VicePresident> getVicePresident(String name) {
		if(vicePresidents.size() < vicePresidentQuantity) {
			VicePresident vicePresidentpresident = new VicePresident(name);
			vicePresidents.add(vicePresidentpresident);
		}
		return vicePresidents;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}